home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
unixSyscall
/
RCS
/
mknod.c,v
< prev
next >
Wrap
Text File
|
1991-12-10
|
3KB
|
164 lines
head 1.3;
branch ;
access ;
symbols sprited:1.1.1;
locks ; strict;
comment @ * @;
1.3
date 88.06.29.15.41.05; author ouster; state Exp;
branches ;
next 1.2;
1.2
date 88.06.21.17.14.35; author ouster; state Exp;
branches ;
next 1.1;
1.1
date 88.06.19.14.31.38; author ouster; state Exp;
branches 1.1.1.1;
next ;
1.1.1.1
date 91.12.10.15.52.48; author kupfer; state Exp;
branches ;
next ;
desc
@@
1.3
log
@No longer need to include kernel/fs.h
@
text
@/*
* mknod.c --
*
* Procedure to map from Unix mknod system call to Sprite.
*
* Copyright (C) 1986 Regents of the University of California
* All rights reserved.
*/
#ifndef lint
static char rcsid[] = "$Header: mknod.c,v 1.2 88/06/21 17:14:35 ouster Exp $ SPRITE (Berkeley)";
#endif not lint
#include "sprite.h"
#include "fs.h"
#include "compatInt.h"
#include <errno.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
/*
*----------------------------------------------------------------------
*
* mknod --
*
* Procedure to map from Unix mkdir system call to Sprite Fs_MakeDevice.
* Unfortunately, this doesn't map from Unix land device types to
* Sprite device types. This means a tar of /dev on a UNIX system
* will not be recreated correctly on a Sprite system, unless the
* tar program itself is fixed.
*
* Results:
* UNIX_ERROR is returned upon error, with the actual error code
* stored in errno. Otherwise UNIX_SUCCESS is returned.
*
* Side effects:
* Creates a special file used to refer to a device.
*
*----------------------------------------------------------------------
*/
int
mknod(pathName, mode, dev)
char *pathName; /* The name of the directory to create */
int mode; /* Permission mask plus type */
int dev; /* Specifies minor and major dev numbers */
{
ReturnStatus status; /* result returned by Fs_Open */
int streamID;
switch (mode & S_IFMT) {
case S_IFREG:
status = Fs_Open(pathName, FS_CREATE, mode & 0777, &streamID);
if (status == SUCCESS) {
(void)close(streamID);
}
break;
case S_IFBLK:
case S_IFCHR: {
Fs_Device device;
device.serverID = FS_LOCALHOST_ID;
device.type = major(dev);
device.unit = minor(dev);
status = Fs_MakeDevice(pathName, &device, mode & 0777);
break;
}
default:
errno = EINVAL;
return(UNIX_ERROR);
}
if (status != SUCCESS) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
} else {
return(UNIX_SUCCESS);
}
}
@
1.2
log
@Forget you ever heard about FIFOs.
@
text
@d11 1
a11 1
static char rcsid[] = "$Header: mknod.c,v 1.1 88/06/19 14:31:38 ouster Exp $ SPRITE (Berkeley)";
a15 1
#include "kernel/fs.h"
@
1.1
log
@Initial revision
@
text
@d11 1
a11 1
static char rcsid[] = "$Header: mknod.c,v 1.3 87/06/04 13:44:47 brent Exp $ SPRITE (Berkeley)";
a71 7
case S_IFIFO:
status = Fs_Open(pathName, FS_CREATE|FS_NAMED_PIPE_OPEN,
mode & 0777, &streamID);
if (status == SUCCESS) {
(void)close(streamID);
}
break;
@
1.1.1.1
log
@Initial branch for Sprite server.
@
text
@d11 1
a11 1
static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/mknod.c,v 1.1 88/06/19 14:31:38 ouster Exp $ SPRITE (Berkeley)";
@